/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package bll;

import java.util.ArrayList;
import object.NamHoc;
import dal.DsNamHocDAL;
import java.sql.ResultSet;
import object.DsNamHoc;
/**
 *
 * @author Le Thai
 */

//lay danh sach cac nam hoc
public class  DsNamHocBll{
    public DsNamHocBll(){
    
    }
    
    public DsNamHoc layDsNamHoc(){
        ArrayList<NamHoc> dsNamHoc=new ArrayList<>();
        DsNamHocDAL dsNamDAL=new DsNamHocDAL();
        ResultSet res;
        res=dsNamDAL.getYearList();
        try {
            while(res.next()){
                int id=res.getInt(1);
                String year=res.getString(2);
                dsNamHoc.add(new NamHoc(id,year));
            }
        } catch (Exception e) {
            System.out.println("[DsNamHocBll][layDsNamHoc]"+e.getMessage());
        }
        DsNamHoc ds=new DsNamHoc(dsNamHoc);
        return ds;
    }
}
